clear


import delimited "Data_prepared_for_frm_in_STATA\frm_data_expertise_aussschuss.csv"


// Interaction model with ausschuss_dummy

// subgroup ausschuss_dummy = 0

drop if ausschuss_dummy == 1

frm share_of_tweets_for_each_ausschu share_in_manifesto, linkfrac(loglog)
estimates store frac_loglog

// output regression table
outreg2 using tab_a9_results_expertise.doc, replace ctitle(Model 1)

// perform RESET test using two powers
frm_reset, l(2)

// perform GOF tests
frm_ggoff // Stat  1.609  pvalue  0.2046

// compute APE
margins, dydx(share_in_manifesto)
// generate plot
margins, at(share_in_manifesto = (0 (0.01) .23))   saving("Data_frm_results_from_STATA\expertise_ausschuss_data_margins_ausschuss_dummy0.dta")
marginsplot


// subgroup top issue = 1
clear
import delimited "Data_prepared_for_frm_in_STATA\frm_data_expertise_aussschuss.csv"


drop if ausschuss_dummy == 0

// estimate fractional logit model using the user-written frm command
frm share_of_tweets_for_each_ausschu share_in_manifesto, linkfrac(loglog)
estimates store frac_loglog

// output regression table
outreg2 using tab_a9_results_expertise.doc, append ctitle(Model 2)

// perform RESET test using two powers
frm_reset, l(2)

// perform GOF tests
frm_ggoff // Stat 6.515  pvalue  0.0107

// compute APE
margins, dydx(share_in_manifesto)
// generate plot

margins, at(share_in_manifesto = (0 (0.01) 0.23))    saving("Data_frm_results_from_STATA\expertise_ausschuss_data_margins_ausschuss_dummy1.dta")
marginsplot